package com.qiaofang.housewarehouse.stub.feign.client.impl;

import com.qiaofang.common.exception.BusinessException;
import com.qiaofang.housewarehouse.stub.constants.ResponseCode;
import com.qiaofang.housewarehouse.stub.facade.HouseCollectionQualityFacade;
import com.qiaofang.housewarehouse.stub.feign.client.HouseCollectionQualityClient;
import com.qiaofang.housewarehouse.stub.request.HouseCollectionQualityRequest;
import com.qiaofang.housewarehouse.stub.response.HouseCollectionQualityResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HouseCollectionQualityClientImpl implements HouseCollectionQualityClient {

    @Autowired
    private HouseCollectionQualityFacade houseCollectionQualityFacade;

    @Override
    public HouseCollectionQualityResponse getHouseCollectionQuality(HouseCollectionQualityRequest houseCollectionQualityRequest) {
        HouseCollectionQualityResponse response = houseCollectionQualityFacade.getHouseCollectionQuality(houseCollectionQualityRequest);
        if (ResponseCode.RC_SUCCESS.getResponseCode().equals(response.getResponseCode())) {
            return response;
        } else {
            throw new BusinessException(response.getResponseCode(), response.getResponseMessage());
        }
    }
}
